package exercise.no1;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-24
 */
public class News {
    private String name;
    private String content;

    public News(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        String ret;
        if (this.name.length() > 15) {
            StringBuilder tmp = new StringBuilder();
            tmp.append(this.name, 0, 16);
            tmp.append("...");
            ret = tmp.toString();
        } else {
            ret = this.name;
        }
        return ret;
    }
}
